﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using ZH.GPT.Infrastructures.Entities;

namespace ZH.GPT.Infrastructures.Configurations
{
    public class ChatMessasgeConfiguration : IEntityTypeConfiguration<ChatMessage>
    {
        public void Configure(EntityTypeBuilder<ChatMessage> builder)
        {
            builder.ToTable("chat_message");

            builder.HasComment("gpt聊天消息")
                .HasCharSet("utf8")
                .UseCollation("utf8_general_ci");


            builder.Property(e => e.Id)
                .HasColumnName("id")
                .HasComment("id");


            builder.Property(e => e.UserId)
                .HasColumnName("user_id")
                .HasComment("用户id");

            builder.Property(e => e.ChatId)
                .HasColumnName("chat_id")
                .HasComment("聊天id");


            builder.Property(e => e.Content)
                .HasColumnName("content")
                .HasComment("消息内容");


            builder.Property(e => e.Sort)
                .HasColumnName("sort")
                .HasComment("消息排序");
            builder.Property(e => e.Role)
                .HasColumnName("role")
                .HasComment("消息角色");

            builder.Property(e => e.CreatedTime)
                .HasColumnName("created_time")
                .HasComment("消息创建时间");
        }
    }
}
